<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>vue基础知识</title>

</head>
<body>
    <div id="app">
        <h1>{{msg}}</h1>

        <form>
            id:<input type="text" v-model="user.id">
            用户名:<input type="text" v-model="user.name">
            年龄:<input type="text" v-model="user.age">
            <input type="button" @click="reg" value="注册">
<!--            <button @click="reg">注册</button>-->
        </form>


    </div>
</body>
</html>

<script src="js/vue.js"></script>

<script>
    new Vue({
        el:"#app",
        data:{
            msg:"小明",
            user:{},
        },
        methods:{
            reg(){
                console.log("user:" + this.user)
                console.log("id:" + this.user.id + "name:"+this.user.name+ "age:"+this.user.age)
                alert(this.user.id)
            }
        }
    })
</script>
